package com.mad.bikepony.portlet;

public enum StatusCode {

	
	STATUS_OK ( 0),
	STATUS_ERR_ALREADY_LOGGED_IN ( 1),
	STATUS_ERR_ALREADY_LOGGED_OFF ( 2),
	STATUS_ERR_PENDING_TASKS ( 3),
	STATUS_ERR_REORDERING_NOT_ALLOWED(4),
	STATUS_ERR_INVALID_CREDENTIALS(5),
	STATUS_ERR_UNKNOWN ( -1),
	STATUS_TRACKING_CODE_INVALID(6),
	STATUS_DELIVERY_CODE_INVALID(7),
	STATUS_AGENT_NOT_KNOWN(8);
	
	private final int status_code;
	
	private StatusCode(int status_code)
	{
		this.status_code= status_code;
	}
	public int getStatusCode()
	{
		return this.status_code;
	}
	public static StatusCode fromStatusCode(int status_code)
	{
		for(StatusCode r : StatusCode.values())
		{
			if(r.getStatusCode()==status_code)
				return r;
		}
		throw new IllegalStateException("no resultCode is present");
	}
}
